package com.yyfax.pay.depository.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.yyfax.pay.depository.domain.FuiouCharge;

public interface FuiouChargeDao {
	/**
	 * @mbggenerated
	 */
	int insert(FuiouCharge record);

	/**
	 * 根据业务主键查询对象
	 * 
	 * @author buyi
	 * @date 2017-09-02 15:22:55
	 * @since v2.0.0
	 * @param mchnt_txn_ssn
	 * @return
	 */
	public FuiouCharge selectByBusiId(@Param("busiId") String busiId);

	/**
	 * 更新订单状态
	 * 
	 * @author buyi
	 * @date 2017-09-02 11:31:26
	 * @since v2.0.0
	 * @param busiId
	 * @param dest 目标值
	 * @param orig 源值
	 * @param currentTime
	 * @return
	 * @deprecated 作废，使用接口{@linkplain FuiouChargeDao#updateStateFromOrigState} since 2.2.2 edit by buyi
	 */
	public int updateState(@Param("busiId") String busiId, @Param("destState") String dest, @Param("origState") String orig,
			@Param("rspCode") int rspCode, @Param("rspMsg") String rspMsg, @Param("currentTime") String currentTime);

	/**
	 * 更新订单状态
	 * 
	 * @author buyi
	 * @date 2018-06-20 15:03:00
	 * @since v2.2.2
	 * @param busiId
	 * @param dest
	 * @param orig
	 * @param rspCode
	 * @param rspMsg
	 * @return
	 */
	public int updateStateFromOrigState(@Param("busiId") String busiId, @Param("destState") String dest, @Param("origState") String orig,
			@Param("rspCode") int rspCode, @Param("rspMsg") String rspMsg);

	/**
	 * 更新订单状态
	 * 
	 * @author buyi
	 * @date 2017-09-25 20:14:31
	 * @since v2.0.0
	 * @param busiId
	 * @param dest
	 * @param rspCode
	 * @param rspMsg
	 * @param origStates 源状态集合
	 * @return
	 */
	public int updateStateFromOrigStates(@Param("busiId") String busiId, @Param("destState") String dest, @Param("rspCode") int rspCode,
			@Param("rspMsg") String rspMsg, @Param("currentTime") String currentTime, @Param("origStates") List<String> origStates);

	/**
	 * 根据商户号和商户订单号查询充值订单
	 *
	 * @author yejc
	 * @date 2017-09-26
	 * @since v2.0.0
	 * @param merchantCode
	 * @param orderId
	 * @return
	 */
	FuiouCharge selectByMerchantCodeAndOrderId(@Param("merchantCode") String merchantCode, @Param("orderId") String orderId);

	/**
	 * 更新异步通知状态<br>
	 * 更新订单交易结果，和异步通知状态
	 * 
	 * @author buyi
	 * @date 2018-06-06 11:45:57
	 * @since v2.2.1
	 * @param busiId
	 * @param dest
	 * @param orig
	 * @param rspCode
	 * @param rspMsg
	 * @return
	 */
	public int updateNotifyState(@Param("busiId") String busiId, @Param("destState") String dest, @Param("origState") String orig,
			@Param("rspCode") int rspCode, @Param("rspMsg") String rspMsg);

	/**
	 * 更新订单状态和异步通知状态
	 *
	 * @author wangjwy
	 * @date 2018/6/28 10:30
	 * @since 2.2.3
	 * @param busiId, dest, origin, rspCode, rspMsg, notifyState
	 * @return int
	 * @throws Exception
	 */
	public int updateStateAndNotify(@Param("busiId") String busiId, @Param("destState") String dest,
								 @Param("rspCode") Integer rspCode, @Param("rspMsg") String rspMsg,@Param("isNotify")String notifyState);
}